init:
    $ renpy.register_bmfont("final", 100, filename="full/final.fnt")
    image text_b = renpy.ParameterizedText(ypos=0.5,size=100,slow_cps=8,slow_abortable=False,font="final")
    image text_e = renpy.ParameterizedText(ypos=0.5,size=42)
    image text_en = renpy.ParameterizedText(yalign=0.5,xalign=.5,text_align=.5,size=42,outlines=[(7,"#0005"),(4,"#0007"),(2,"#000A"),(1,"#444")] )
    $ renpy.register_bmfont("end", 18, filename="full/end.fnt")
    $ E = Character("", window_style="endT",window_yalign=0.98, what_slow_cps=20,window_xmaximum=1000,window_xalign=0.5,what_font="end")
    $ SE = Character("",window_style="endT",what_style="tip",window_yalign=0.98, what_slow_cps=40,window_xmaximum=1000,window_xalign=0.5)
label credits:
    scene black
    hide screen main_menu
    with dissolve
    scene create at Pan((0, 0), (0, 900), 45.0)
    with dissolve
    python hide:
        
        renpy.transition(config.intra_transition)
        ui.frame(style=style.trbutt,xminimum=620,xmaximum=620,xalign=.5,yalign=.5)
        ui.vbox(xfill=True)
        ui.null(height=20)
        ui.text("{size=36}开发者选项{/size}{p}{p}{size=24}游戏设计&编程{/size}{p}{size=18}Celso Riva{/size}{p}{p}{size=24}主菜单&角色图像{/size}{p}{size=18}Marlon Teunissen{/size}{p}{p}{size=24}背景及其他图像{/size}{p}{size=18}Péter G., Sanupawaka, H.R.Morris, Meago, Mª Beatriz García {/size}{p}{p}{size=24}编剧{/size}{p}{size=18}Aleema{/size}{p}{p}{size=24}gamux汉化{/size}{p} saro, ak,生菜,鸡",xpos=0.5,xalign=0.5,drop_shadow=[(1,1),(-1,-1),(1,-1),(-1,1)])
        ui.null(height=20)
        layout.button("返回菜单", None, clicked=ui.jumps("_return"),xalign=0.5)
        ui.close()
        ui.interact()
    return
label buynow:
    python hide:
        
        import webbrowser
        webbrowser.open_new('http://www.winterwolves.com/spiritedheart.htm')
        renpy.quit()
    return
init:
    python:
        
        import urllib
        import urllib2
        import webbrowser
        import md5
        HTTPError="";URLError=""
        def http(url,va):
            values = {'v1' : va[0]}
            for i in range(len(va)-1):
                values["v"+str(2+i)] = va[i+1]
            data = urllib.urlencode(values)
            req = urllib2.Request(url, data)
            try:
                response = urllib2.urlopen(req)
                the_page = response.read()
                return the_page
            except:
                return "fail"
label about:
    scene black
    hide screen main_menu
    with dissolve
    scene create at Pan((0, 0), (0, 900), 45.0)
    with dissolve
    $ email=persistent.email;success=False;advice=0
label aboutloop:
    python:
        
        renpy.transition(dissolve)
        with ui.hbox(10,xalign=.5,yalign=.05):
            ui.frame(style="trbutt",xminimum=400,yminimum=250)
            with ui.vbox(xmaximum=380,xfill=True,xalign=.5):
                ui.image("gfx/buy1.png", xalign=.5)
                ui.text("Male romance options\n",xalign=.5,size=25,style="tip")
                if persistent.topogigio==None:
                    ui.text("未注册",xalign=.5,size=25,style="tip")
                else:
                    ui.text("已注册",xalign=.5,size=25,style="tip")
            ui.frame(style="trbutt",xminimum=400,yminimum=250)
            with ui.vbox(xmaximum=380,xfill=True,xalign=.5):
                ui.image("gfx/buy2.png", xalign=.5)
                ui.text("女性浪漫选项\n",xalign=.5,size=25,style="tip")
                if persistent.minnie==None:
                    ui.text("未注册",xalign=.5,size=25,style="tip")
                else:
                    ui.text("已注册",xalign=.5,size=25,style="tip")
        if persistent.topogigio==None or persistent.minnie==None:
            ui.frame(xmaximum=950,xfill=True,xalign=.5,yalign=.9,style="trbutt")
            with ui.vbox(2,xalign=.5):
                ui.null(height=8)
                ui.text("One time online activation\n",xalign=.5,size=25,style="tip")
                ui.text("如果你买过这个游戏，你可以在此界面激活.\n如果你用不同的游戏买过该游戏不同的版本 你只需要重复注册两次（两个中的任意一个）.",xalign=.5,size=20)
                ui.null(height=15)
                ui.text("{color=#FF0}提示: 使用激活码，邮箱激活没有什么区别{/color}",size=18)
                ui.null(height=15)
                ui.text("\n输入激活码或者购买过本游戏的邮箱地址，然后确定",size=20,xalign=.5)
                ui.null(height=8)
                ui.input(email,exclude='{ \'}',xalign=.5)
                ui.null(height=12)
                with ui.hbox(xcenter=.5):
                    ui.textbutton("{size=25}返回主菜单{/size}", clicked=ui.jumps("_return"),xalign=.5,style="trbutt",xminimum=400,yminimum=48)
                    ui.textbutton("{size=25}访问官网{/size}", clicked=ui.jumps("buynow"),xalign=.5,style="trbutt",xminimum=400,yminimum=48)
                ui.null(height=8)
        if advice>0:
            ui.frame(xminimum=1024,yminimum=768)
            ui.frame(xalign=0.5,yalign=0.5,xminimum=800,style="trbutt")
            ui.vbox(xmaximum=780,xfill=True,xalign=0.5)
            if advice==1:
                ui.text(whatregister+" 注册成功！ 你可以拥有完整的游戏体验了。感谢您对本游戏的支持，开发者在这里对您说声谢谢\n",size=20)
            elif advice==2:
                ui.text("邮箱信息未在数据库中发现，请确认是否输入正确\n",size=20)
            elif advice==3:
                ui.text("Sorry, but this email has already been activated 3 times in the last week. Please remember that sharing the registration info is not allowed!\n\nEmail the developer at info@winterwolves.com if you believe this is an error.",size=20)
            elif advice==99:
                ui.text("注册未成功\n\n请确保连网通畅，关闭代理和防火墙等阻止游戏网络进程的软件，然后重试。\n\n如果问题没有解决，请联系开发者info@winterwolves.com\n",size=20)
            ui.null(height=18)
            ui.textbutton("Okay",xalign=0.5,clicked=ui.returns("done"),style="trbutt",xminimum=200,yminimum=48)
            ui.close()
            ui.interact()
            if advice>0:
                advice=0
            if persistent.topogigio and persistent.minnie:
                renpy.jump("_return")
        else:
            email=ui.interact()
            persistent.email=email;success=0;success2=0
            if email.find("@")>=0:
                success=http("http://www.winterwolves.com/checkit.php",[email,"SpiritedHeart"])
                success2=http("http://www.winterwolves.com/checkit.php",[email,"SpiritedHeartGirls"])
            else:
                
                token="";token2="";advice=4
                for i in range(15000):
                    token=md5.new(str(i)+"SpiritedHeartNormale").hexdigest().upper()
                    token2=token[8:12]+"-"+token[12:16]+"-"+token[16:20]+"-"+token[20:24]
                    if email.upper()==token2:
                        success="ok"
                        break
                
                token="";token2="";advice2=4
                for i in range(15000):
                    token=md5.new(str(i)+"SpiritedHeartYuri").hexdigest().upper()
                    token2=token[8:12]+"-"+token[12:16]+"-"+token[16:20]+"-"+token[20:24]
                    if email.upper()==token2:
                        success2="ok"
                        break
            if success=="ok":
                advice=1; persistent.topogigio=True;whatregister="Spirited Heart boy romance"
            if success2=="ok":
                advice=1; persistent.minnie=True;whatregister="Spirited Heart girl romance"
            if success=="ok" and success2=="ok":
                whatregister="Spirited Heart complete game"
            if success=="ok" or success2=="ok":
                pass
            elif success=="max" or success2=="max":
                advice=3
            else:
                advice=99
    jump aboutloop